home *** CD-ROM | disk | FTP | other *** search
Text File | 1996-04-25 | 52.1 KB | 1,985 lines |
- 'This script simulates a command line. It enables users to perform most CorelCAD commands using a command line interface.
- '
- '*************************************************************************************
- '********************** COMMAND LINE **********************************
- '*************************************************************************************
- '*************************************************************************************
- 'April 25, 1996
- '
- ' This script simulates a command line. It enables the user to perform many CorelCAD
- ' commands using the keyboard. A list of commands and/or objects is available by typing "LIST".
- '
- '
- ' Coordinate entry is possible through two main methods:
- '
- ' Normal: 5,5,5
- ' Relative: @5,5,5
- '
- 'Written by Dave Climie, ⌐ 1995-1996 Corel Corporation. All rights reserved.
- '*************************************************************************************
- '*************************************************************************************
- '************************ DECLARATIONS *************************************
- '*************************************************************************************
- '*************************************************************************************
- DECLARE SUB DoMove()
- DECLARE SUB DoScale()
- DECLARE SUB DoExtrude()
- DECLARE SUB DoPaste()
- DECLARE SUB DoChangeColor()
- DECLARE SUB DoZoom()
-
- DECLARE SUB GetCoord (DiaText$,X#,Y#,Z#,ESC%) 'allows user to enter a coordinate (x,y,z)
- DECLARE SUB GetValue (DiaText$,dX#,ESC%) 'allows user to enter a magnitude (distance, angle, etc..)
- DECLARE SUB GetLetter (TitleText$,DiaText$,LetAvail$,LetPicked$,ESC%)
-
- DECLARE SUB Array() 'array functions
- DECLARE SUB LinearArr(DoOverall%, ESC%)
- DECLARE SUB TwoDArr(DoOverall%, ESC%)
- DECLARE SUB ThreeDArr(DoOverall%, ESC%)
- DECLARE SUB CircleArr(ESC%)
- DECLARE SUB SpiralArr(ESC%)
- DECLARE SUB SphereArr(ESC%)
-
- DECLARE SUB CreateArc() 'arc drawing functions
- DECLARE SUB CreateArc3Points(WireFlag%, ESC%) 'WIREFLAG FOR PROPERTIES:
- DECLARE SUB CreateArcAngle(WireFlag%, ESC%) '0: WIRE ARC
- DECLARE SUB CreateArcCSE(WireFlag%, ESC%) '1: CENTER (creates surface)
- DECLARE SUB CreateArcEllipses(WireFlag%, ESC%) '2: END POINT (creates surface)
- DECLARE SUB CreateArcRSE(WireFlag%, ESC%)
-
- DECLARE SUB CreateBox() 'box drawing function
-
- DECLARE SUB CreateCircle() 'circle drawing functions
- DECLARE SUB CreateCircle3Point(WireFlag%, ESC%)
- DECLARE SUB CreateCircleDiameter(WireFlag%, ESC%)
- DECLARE SUB CreateCircleRadius(WireFlag%, ESC%)
-
- DECLARE SUB CreateCone() 'draws cone
- DECLARE SUB CreateCylinder() 'draws cylinder
-
- DECLARE SUB CreateEllipse()
- DECLARE SUB CreateFrustum()
- DECLARE SUB CreateHemisphere()
- DECLARE SUB CreateLine (PolyFlag%) 'Boolean, True for Polyline, False for Line Segments
- DECLARE SUB CreatePolygon()
- DECLARE SUB CreateRectangle()
- DECLARE SUB CreateSphere()
- DECLARE SUB CreateTorus()
- '*************************************************************************************
- '***************************** VARIABLE DECLARATIONS ****************************
- '*************************************************************************************
-
- GLOBAL Objects$(15)
- GLOBAL Command$(30)
-
- GLOBAL ObjPicked%
- GLOBAL CmdPicked%
-
- ObjPicked = 1 'sets these as the default to display to the user
- CmdPicked = 1
-
- '*************************************************************************************
- '*************************************************************************************
- '************************ MAIN ********************************************
- '*************************************************************************************
- '*************************************************************************************
- '*************************************************************************************
-
- DIM Entry$ 'Used to store what is typed in by user at command line
- DIM WhichList$ ' Stores the type of list the user wants to see
-
- Start:
-
- Entry$=""
-
- BEGIN DIALOG Commnd 47, 372, 254, 16, "Command Bar"
- TEXTBOX 82, 2, 79, 13, Entry$
- OKBUTTON 170, 1, 40, 15
- CANCELBUTTON 214, 1, 40, 15
- TEXT 4, 4, 76, 11, "Type Command or (L)ist:"
- END DIALOG
-
- ret=DIALOG(Commnd)
- if ret=2 then stop
-
- Entry$=UCASE(Entry$)
- Entry$=LTRIM(Entry$)
- Entry$=RTRIM(Entry$)
-
-
- WITHOBJECT "CorelCAD.Automation.1"
-
- SELECT CASE Entry$
- CASE "A","ARC"
- CreateArc
- CASE "AR","ARR","ARRAY"
- Array
- CASE "B","BO","BOX"
- CreateBox
- CASE "C","CIRC","CIRCLE","CIR","CI"
- CreateCircle
- CASE "COL","COLO","COLOR","COLOUR","CHANGE","CHANGE COLOR"
- DoChangeColor
- CASE "CL","CLOSE"
- .FileClose
- CASE "CO","CONE"
- CreateCone
- CASE "COPY","COP"
- .EditCopy
- CASE "CY","CYLINDER","CYL"
- CreateCylinder
- CASE "D","DEF","DEFINE"
- .SolidDefine
- CASE "DEL","DELETE"
- .DeleteSelection
- CASE "DE","DES","DESELECT","DESELECT ALL"
- .SelectPointAt 1000,1000, -1, -1
- CASE "DU","DUPE","DUPLICATE"
- .Duplicate
- CASE "E","ELLIPSE","EL","ELL"
- CreateEllipse
- CASE "EXIT"
- Goto DONEALL
- CASE "EXPLODE","EX","EXP","EXPL"
- .SolidExplode
- CASE "EXT","EXTRUDE"
- DoExtrude
- CASE "F","FR","FRU","FRUSTUM"
- CreateFrustum
- CASE "G","GR","GRO","GROU","GROUP"
- .Group
- CASE "H","HEMI","HEMISPHERE"
- CreateHemisphere
- CASE "HIDE","HIDDEN","HI"
- .HideEntireView false, false, false, false
- CASE "L","LIST"
- goto LIST
- CASE "LI","LIN","LINE"
- CreateLine FALSE
- CASE "M","MO","MOVE"
- DoMove
- CASE "N","NEW"
- .FileNew
- CASE "PA","PAS","PASTE"
- DoPaste
- CASE "P","PO","POLYLINE"
- CreateLine TRUE
- CASE "POLY", "POLYGON","TRIANGLE"
- Createpolygon
- CASE "Q","QUIT"
- Goto DONEALL
- CASE "R","RE","RED","REDO"
- .Redo
- CASE "REC","RECT","RECTANGLE","SQUARE"
- CreateRectangle
- CASE "REF","REFRESH"
- .WireFrame
- CASE "REN","REND","RENDER","RENDER VIEW","RENDERED VIEW","SH","SHADE","SHADE VIEW","SHADED VIEW"
- .ShadeEntireView TRUE, TRUE, 1, TRUE
- CASE "S","SC","SCA","SCALE"
- DoScale
- CASE "SA","SE","SELECTALL","SELECT","SELECT ALL"
- .SelectAll
- CASE "SP","SPH","SPHERE"
- CreateSphere
- CASE "T","TO","TOR","TORUS"
- CreateTorus
- CASE "U","UN","UND","UNDO"
- .Undo
- CASE "UNG","UNGR","UNGROUP","UN GROUP","UN-GROUP"
- .UnGroup
- CASE "V"
- DoMove
- CASE "W","WI","WIRE","WIREFRAME"
- .WireFrame
- CASE "X"
- .SolidExplode
- CASE "Z","ZOO","ZOOM"
- DoZoom
- CASE "ZA","ZOOM ALL"
- .zoomToAll
- CASE "ZO","ZOOM OUT"
- .zoomout
- CASE "ZI","ZOOM IN"
- T1:
- GetCoord "Enter the first point for the zoom box:",X#,Y#,Z#,ESC%
- If ESC = true then goto T2
- GetCoord "Enter the end point for the zoom box:",X1#,Y1#,Z1#,ESC%
- If ESC = true then goto T1
- .ZoomIn X,Y,Z,X1,Y1,Z1
- T2:
- CASE "ZP","ZOOM PREVIOUS"
- .zoomprevious
- CASE "ZS","ZOOM SEL","ZOOM SELECTED","ZOOM TO SELECTED"
- .zoomtoselected
- CASE else
- Message "Command does not exist."
- GOTO START
- END SELECT
-
- GOTO START
- END WITHOBJECT
-
- '*************************************************************************************
- LIST:
-
- DIM ESC%
-
- ESC = FALSE
- GetLetter "List Type","(C)ommand List or (O)bject List ?","CO",WhichList$,ESC%
-
- If ESC = TRUE then Goto Start
-
- Select Case WhichList
- CASE "O"
- Goto LISTOBJ
- CASE "C"
- Goto LISTCOM
- End Select
-
- '*************************************************************************************
- LISTCOM:
-
- Command(1) = "Array"
- Command(2) = "Change Color"
- Command(3) = "Close File" 'This is the list of commands available to be executed
- Command(4) = "Copy" ' (Displayed when user prompts for command list)
- Command(5) = "Define Object"
- Command(6) = "Delete"
- Command(7) = "Deselect All"
- Command(8) = "Draw an object"
- Command(9) = "Duplicate"
- Command(10) = "Explode Object"
- Command(11) = "Extrude"
- Command(12) = "Group"
- Command(13) = "Hidden Line View"
- Command(14) = "List of Objects"
- Command(15) = "Move"
- Command(16) = "New File"
- Command(17) = "Object List"
- Command(18) = "Paste"
- Command(19) = "Redo"
- Command(20) = "Refresh"
- Command(21) = "Rendered View"
- Command(22) = "Scale"
- Command(23) = "Select All"
- Command(24) = "Undo"
- Command(25) = "Ungroup"
- Command(26) = "Zoom Commands"
- Command(27) = "Zoom To All"
- Command(28) = "Zoom To Selected"
- Command(29) = "Zoom Out"
- Command(30) = "Zoom Previous"
-
- BEGIN DIALOG DDlistboxdlg 47, 372, 254, 16, "Command List"
- TEXT 4, 4, 90, 8, "&List:"
- DDLISTBOX 23, 2, 138, 106, Command,CmdPicked
- OKBUTTON 170, 1, 40, 15
- CANCELBUTTON 214, 1, 40, 15
- END DIALOG
-
- ret = DIALOG(DDlistboxdlg)
- if ret = 2 then goto LIST
-
- WITHOBJECT "CorelCAD.Automation.1"
- SELECT CASE CmdPicked
- CASE 1
- Array
- CASE 2
- DoChangeColor
- CASE 3
- .FileClose
- CASE 4
- .EditCopy
- CASE 5
- .SolidDefine
- CASE 6
- .DeleteSelection
- CASE 7
- .SelectPointAt 1000,1000,-1,-1
- CASE 8
- Goto LISTOBJ
- CASE 9
- .Duplicate
- CASE 10
- .SolidExplode
- CASE 11
- DoExtrude
- CASE 12
- .Group
- CASE 13
- .Dohide
- CASE 14
- goto LISTOBJ
- CASE 15
- DoMove
- CASE 16
- .FileNew
- CASE 17
- Goto LISTOBJ
- CASE 18
- DoPaste
- CASE 19
- .redo
- CASE 20
- .wireframe
- CASE 21
- .ShadeEntireView TRUE, TRUE, 1, TRUE
- CASE 22
- DoScale
- CASE 23
- .SelectAll
- CASE 24
- .Undo
- CASE 25
- .Ungroup
- CASE 26
- DoZoom
- CASE 27
- .ZoomToAll
- CASE 28
- .ZoomToSelected
- CASE 29
- .ZoomOut
- CASE 30
- .ZoomPrevious
- CASE else
- Message "Undefined command"
- end SELECT
- END WITHOBJECT
-
- GOTO LISTCOM
- '*************************************************************************************
- LISTOBJ:
-
- Objects(1) = "ARC" 'This is the list of Objectss available to be drawn
- Objects(2) = "BOX" ' (Displayed when user prompts for Objects list)
- Objects(3) = "CIRCLE"
- Objects(4) = "COMMAND LIST"
- Objects(5) = "CONE"
- Objects(6) = "CYLINDER"
- Objects(7) = "ELLIPSE"
- Objects(8) = "FRUSTUM"
- Objects(9) = "HEMISPHERE"
- Objects(10) = "LINE SEGMENTS"
- Objects(11)= "POLYGON"
- Objects(12) = "POLYLINE"
- Objects(13) = "RECTANGLE"
- Objects(14) = "SPHERE"
- Objects(15) = "TORUS"
-
-
- BEGIN DIALOG ListObBox 47, 372, 254, 16, "Object List"
- TEXT 4, 4, 90, 8, "&List:"
- DDLISTBOX 23, 2, 138, 106, Objects,ObjPicked
- OKBUTTON 170, 1, 40, 15
- CANCELBUTTON 214, 1, 40, 15
- END DIALOG
-
- Return = DIALOG(ListObBox)
- If Return = 2 then goto LIST
-
- WITHOBJECT "CorelCAD.Automation.1"
- SELECT CASE ObjPicked
- CASE 1
- CreateArc
- CASE 2
- CreateBox
- CASE 3
- CreateCircle
- CASE 4
- Goto LISTCOM
- CASE 5
- CreateCone
- CASE 6
- CreateCylinder
- CASE 7
- CreateEllipse
- CASE 8
- CreateFrustum
- CASE 9
- CreateHemisphere
- CASE 10
- CreateLine FALSE
- CASE 11
- CreatePolygon
- CASE 12
- CreateLine TRUE
- CASE 13
- CreateRectangle
- CASE 14
- CreateSphere
- CASE 15
- CreateTorus
- CASE ELSE
- Message "Undefined Command"
- End Select
-
- END WITHOBJECT
-
- GOTO LISTOBJ
- DONEALL:
- '*************************************************************************************
- '*************************************************************************************
- '************************** DRAWING FUNCTIONS *************************
- '*************************************************************************************
- '*************************************************************************************
- SUB Array
-
- DIM Correct%
- DIM TypeArray$
- DIM DistanceType$
- DIM DoOverall%
- DIM ESC%
-
- DOARRAY:
- ESC = False
- GetLetter "ARRAY -- Define type","(L)in,(2)D,(3)D,(C)irc,(S)piral,S(p)here","L23CSP",TypeArray$,ESC%
- If ESC = True then GOTO DoneArray 'takes user back to command line
-
- Correct = CBOL(INSTR("L23",TypeArray))
-
- If Correct = true then
- StepArray:
- ESC = false
- GetLetter "Distance Mode","(I)ncremental or (O)verall distance ?","IO",DistanceType$,ESC%
- If ESC = True then GOTO DOARRAY 'takes user back to "array -- define type"
- If DistanceType = "O" then DoOverall = 1
- else DoOverall = 0
- END IF
-
- SELECT CASE TypeArray$
- CASE "L"
- LinearArr DoOverall,ESC
- If ESC = true then goto StepArray
- CASE "2"
- TwoDArr DoOverall,ESC
- If ESC = true then goto StepArray
- CASE "3"
- ThreeDArr DoOverall,ESC
- If ESC = true then goto StepArray
- CASE "C"
- CircleArr ESC
- If ESC = true then goto DoArray
- CASE "S"
- SpiralArr ESC
- If ESC = true then goto DoArray
- CASE "P"
- SphereArr ESC
- If ESC = true then goto DoArray
- END SELECT
-
- DoneArray:
- END SUB
- '*************************************************************************************
- SUB LinearArr (DoOverall%,ESC%)
-
- DIM NumCop#
- DIM NumCopies%
- DIM dX#,dY#,dZ#
-
- Lin1:
- GetValue "LINEAR ARRAY -- # of copies",NumCop#,ESC%
- NumCopies=cint(NumCop)
- If ESC = true then goto Lin2
- GetCoord "LINEAR ARRAY -- Vector between copies",dX#,dY#,dZ#,ESC%
- If ESC = true then GOTO Lin1
-
- WITHOBJECT "CorelCAD.Automation.1"
- .LinearArray DoOverall,NumCopies,0,0,0,dX,dY,dZ
- END WITHOBJECT
-
- Lin2:
- END SUB 'LinearArr
- '*************************************************************************************
- SUB TwoDArr (DoOverall%,ESC%)
-
- DIM NumCop1#,NumCop2#
- DIM NumCopies1&,NumCopies2&
- DIM X1#,Y1#,Z1#,X2#,Y2#,Z2#
-
- TWO1:
- GetValue "2D ARRAY -- # of copies in 1st direction",NumCop1#,ESC%
- NumCopies1=cint(NumCop1)
- If ESC = true then GOTO TWO4
- TWO2:
- GetValue "2D ARRAY -- # of copies in 2nd direction",NumCop2#,ESC%
- NumCopies2=cint(NumCop2)
- If ESC = true then GOTO TWO1
- TWO3:
- GetCoord "2D ARRAY -- Vector between copies (Dir 1)",X1#,Y1#,Z1#,ESC%
- If ESC = true then GOTO TWO2
-
- GetCoord "2D ARRAY -- Vector between copies (Dir 2)",X2#,Y2#,Z2#,ESC%
- If ESC = true then GOTO TWO3
-
- WITHOBJECT "CorelCAD.Automation.1"
- .TwoDArray DoOverall,NumCopies1,NumCopies2,0,0,0,X1,Y1,Z1,X2,Y2,Z2
- END WITHOBJECT
-
- TWO4:
- END SUB 'TwoDArr
- '*************************************************************************************
- SUB ThreeDArr (DoOverall%,ESC%)
-
- DIM NumCop1#,NumCop2#,NumCop3#
- DIM NumCopies1&,NumCopies2&,NumCopies3&
- DIM X1#,Y1#,Z1#,X2#,Y2#,Z2#,X3#,Y3#,Z3#
-
- THREED1:
- GetValue "3D ARRAY -- # of copies in 1st direction",NumCop1#,ESC%
- NumCopies1=cint(NumCop1)
- If ESC = true then GOTO THREED6
- THREED2:
- GetValue "3D ARRAY -- # of copies in 2nd direction",NumCop2#,ESC%
- NumCopies2=cint(NumCop2)
- If ESC = true then GOTO THREED1
- THREED3:
- GetValue "3D ARRAY -- # of copies in 3rd direction",NumCop3#,ESC%
- NumCopies3=cint(NumCop3)
- If ESC = true then GOTO THREED2
- THREED4:
- GetCoord "3D ARRAY -- Vector between copies (Dir 1)",X1#,Y1#,Z1#,ESC%
- If ESC = true then GOTO THREED3
- THREED5:
- GetCoord "3D ARRAY -- Vector between copies (Dir 2)",X2#,Y2#,Z2#,ESC%
- If ESC = true then GOTO THREED4
-
- GetCoord "3D ARRAY -- Vector between copies (Dir 3)",X3#,Y3#,Z3#,ESC%
- If ESC = true then GOTO THREED5
-
-
- WITHOBJECT "CorelCAD.Automation.1"
- .ThreeDArray DoOverall,NumCopies1,NumCopies2,NumCopies3,0,0,0,X1,Y1,Z1,X2,Y2,Z2,X3,Y3,Z3
- END WITHOBJECT
-
- THREED6:
- END SUB 'ThreeDArr
- '*************************************************************************************
- SUB CircleArr(ESC%)
-
- DIM NumCop#
- DIM NumCopies%
- DIM RotateLet$
- DIM Rotate%
- DIM Angle#
-
- Rotate% = 0
- CIR1:
- GetLetter "CIRCULAR ARRAY -- PROPERTIES","Rotate Objects ? (Y) or (N): ","YN",RotateLet$,ESC%
- If ESC = True then goto CIR8
- CIR2:
- GetValue "CIRCULAR ARRAY -- # of copies ",NumCop#,ESC%
- NumCopies=CINT(NumCop)
- If ESC = True then goto CIR1
- CIR3:
- GetValue "CIRCULAR ARRAY -- Angle of rotation",Angle#,ESC%
- If ESC = True then goto CIR2
- WITHOBJECT "CorelCAD.Automation.1"
- If RotateLet="Y" then
- Rotate=-1
- CIR4:
- GetCoord "CIRCULAR ARRAY -- Start Point of Axis of rotation",X1#,Y1#,Z1#,ESC%
- If ESC = True then goto CIR3
- x2=x1
- y2=y1
- z2=z1
- CIR5:
- GetCoord "CIRCULAR ARRAY -- End Point of Axis of rotation",X2#,Y2#,Z2#,ESC%
- If ESC = True then goto CIR4
- .CircularArray NumCopies%,Angle#,Rotate%,X1,y1,z1,x2,y2,z2
- else
- Rotate=0
- CIR6:
- GetCoord "CIRCULAR ARRAY --Base Point for rotation",X1#,Y1#,Z1#,ESC%
- If ESC = True then goto CIR3
- x2=x1
- y2=y1
- z2=z1
- CIR7:
- GetCoord "CIRCULAR ARRAY -- Start Point of Axis of rotation",X2#,y2#,Z2#,ESC%
- If ESC = True then goto CIR6
- x3=x2
- y3=y2
- z3=z2
-
- GetCoord "CIRCULAR ARRAY -- End Point of Axis of rotation",X3#,Y3#,Z3#,ESC%
- If ESC = True then goto CIR7
- .CircularArray NumCopies%,Angle#,Rotate%,X1,y1,z1,x2,y2,z2,x3,y3,z3
- END IF
- END WITHOBJECT
-
- CIR8:
- END SUB 'CircleArr
- '*************************************************************************************
- SUB SpiralArr(ESC%)
-
- DIM NumCop#
- DIM NumCopies%
- DIM RotateLet$
- DIM Rotate%
- DIM Angle#
- DIM Offset#
- DIM x1#,y1#,z1#,x2#,y2#,z2#,x3#,y3#,z3#
-
- Rotate% = 0
- SPI1:
- GetLetter "SPIRAL ARRAY -- PROPERTIES","Rotate Objects ? (Y) or (N): ","YN",RotateLet$,ESC%
- If ESC = True then goto SPI9
- SPI2:
- GetValue "SPIRAL ARRAY -- # of copies ",NumCop#,ESC%
- NumCopies=CINT(NumCop)
- If ESC = True then goto SPI1
- SPI3:
- GetValue "SPIRAL ARRAY -- Angle of rotation",Angle#,ESC%
- If ESC = True then goto SPI2
- Angle#=Angle/360
- SPI4:
- GetValue "SPIRAL ARRAY -- Magnitude of offset",Offset#,ESC%
- If ESC = True then goto SPI3
-
- WITHOBJECT "CorelCAD.Automation.1"
- If RotateLet="Y" then
- Rotate=-1
- SPI5:
- GetCoord "SPIRAL ARRAY -- First Point of Axis of rotation",X1#,Y1#,Z1#,ESC%
- If ESC = True then goto SPI4
- x2#=x1#
- y2#=y1#
- z2#=z1#
- SPI6:
- GetCoord "SPIRAL ARRAY -- End Point of Axis of rotation",X2#,Y2#,Z2#,ESC%
- If ESC = True then goto SPI5
- .SpiralArray NumCopies%,Angle#,Offset#,Rotate%,X1,y1,z1,x2,y2,z2
- else
- Rotate=0
- SPI7:
- GetCoord "SPIRAL ARRAY -- Base Point for rotation",X1#,Y1#,Z1#,ESC%
- If ESC = True then goto SPI4
- x2=x1
- y2=y1
- z2=z1
- SPI8:
- GetCoord "SPIRAL ARRAY -- Start Point of Axis of rotation",X2#,y2#,Z2#,ESC%
- If ESC = True then goto SPI5
- x3=x2
- y3=y2
- z3=z2
-
- GetCoord "SPIRAL ARRAY -- End Point of Axis of rotation",X3#,Y3#,Z3#,ESC%
- If ESC = True then goto SPI6
- .SpiralArray NumCopies%,Angle#,Offset#,Rotate%,X1,y1,z1,x2,y2,z2,x3,y3,z3
- END IF
- END WITHOBJECT
-
- SPI9:
- END SUB 'SpiralArr
- '*************************************************************************************
- SUB SphereArr(ESC%)
-
- DIM Numeq#, Numpo#,Row#
- DIM Numequator%,Numpoles%,Rows%
- DIM Rotateobject$
- DIM Rotate%
-
- DIM x1#,y1#,z1#,x2#,y2#,z2#,x3#,y3#,z3#
-
- Rotate% = 0
- SPH1:
- GetLetter "SPhereARRAY -- PROPERTIES","Rotate Objects ? (Y) or (N): ","YN",RotateLet$,ESC%
- If ESC = True then goto SPH9
- SPH2:
- GetValue "SPere ARRAY -- # of copies in equator ",Numeq#,ESC%
- Numequator=CINT(Numeq)
- If ESC = True then goto SPH1
- SPH3:
- GetValue "SPere ARRAY -- # of copies in poles",Numpo#,ESC%
- Numpoles=CINT(Numpo)
- If ESC = True then goto SPH2
-
- SPH4:
- GetValue "SPere ARRAY -- # of rows",Row#,ESC%
- Rows=CINT(Row)
- If ESC = True then goto SPH3
-
- WITHOBJECT "CorelCAD.Automation.1"
- If RotateLet="Y" then
- Rotate=-1
- SPH5:
- GetCoord "Spere ARRAY -- First Point of Axis of rotation",X1#,Y1#,Z1#,ESC%
- If ESC = True then goto SPH4
- x2#=x1#
- y2#=y1#
- z2#=z1#
- SPH6:
- GetCoord "SPere ARRAY -- End Point of Axis of rotation",X2#,Y2#,Z2#,ESC%
- If ESC = True then goto SPH5
- GetCoord "SPere ARRAY -- End Point of Axis of rotation",X3#,Y3#,Z3#,ESC%
- .SphericalArray Numequator%,numpoles,rows,Rotate%,X1,y1,z1,x2,y2,z2,X3,Y3,Z3
- else
- Rotate=0
- SPH7:
- GetCoord "SPere ARRAY -- Base Point for rotation",X1#,Y1#,Z1#,ESC%
- If ESC = True then goto SPH4
- x2=x1
- y2=y1
- z2=z1
- SPH8:
- GetCoord "SPere ARRAY -- Start Point of Axis of rotation",X2#,y2#,Z2#,ESC%
- If ESC = True then goto SPH5
- x3=x2
- y3=y2
- z3=z2
-
- GetCoord "SPere ARRAY -- End Point of Axis of rotation",X3#,Y3#,Z3#,ESC%
- If ESC = True then goto SPh6
- .SphericalArray Numequator%,numpoles,rows,Rotate%,X1,y1,z1,x2,y2,z2,X3,Y3,Z3
- END IF
- END WITHOBJECT
-
- SPH9:
- END SUB 'SphereArr
-
- '*************************************************************************************
- '*************************** START ARCS ************************************
- '*************************************************************************************
- SUB CreateArc
-
- DIM Wireflag%
- DIM ArcType$
-
- ARC1:
- GetLetter "ARC -- Options","(W)ire, (C)enter, (E)ndpoint:","WCE",ArcType$,ESC%
- If ESC = True then goto ARC2
-
- SELECT CASE ArcType$
- CASE "W"
- WireFlag% = 0
- CASE "C"
- WireFlag% = 1
- CASE "E"
- WireFlag% = 2
- END SELECT
-
-
- DiaAr:
-
- TypeArc = "3"
- BEGIN DIALOG DiaArc 47, 372, 254, 16, "ARC -- Define your Arc"
- TEXT 0, 4, 197, 12, "(3)Pt,(A)ngle,(C)tr,(R)adius,(E)llipse:"
- TEXTBOX 111, 2, 55, 13, TypeArc$
- OKBUTTON 170, 1, 40, 15
- CANCELBUTTON 214, 1, 40, 15
- END DIALOG
-
- ret= DIALOG(DiaArc)
- if ret = 2 then goto ARC1
- TypeArc$=UCASE(TypeArc$)
-
- SELECT CASE TypeArc$
- CASE "3"
- CreateArc3Points Wireflag%,ESC%
- CASE "A"
- CreateArcAngle Wireflag%,ESC%
- CASE "C"
- CreateArcCSE Wireflag%,ESC%
- CASE "E"
- CreateArcEllipses Wireflag%,ESC%
- CASE "R"
- CreateArcRSE Wireflag%,ESC%
- CASE else
- Message "Sorry, not a correct entry. Pick an character in brackets "
- goto DiaAr
- END SELECT
- ' -- -- -- -- -- -
-
- ARC2:
- END SUB
-
- '*************************************************************************************
- SUB CreateArc3Points (Wireflag%,ESC%)
-
- DIM X1#,Y1#,Z1#,X2#,Y2#,Z2#,X3#,Y3#,Z3#
- ARC31:
- ESC=false
- GetCoord "ARC -- Pick start point",X1#,Y1#,Z1#,ESC%
- if ESC=true then goto ARC33
- x2=x1
- y2=y1
- z2=z1
- ARC32:
- ESC=false
- GetCoord "ARC -- Pick 2nd point",X2#,Y2#,Z2#,ESC%
- if ESC=true then goto ARC31
- x3=x2
- y3=y2
- z3=z2
-
- ESC=false
- GetCoord "ARC -- Pick end point",X3#,Y3#,Z3#,ESC%
- if ESC=true then goto ARC32
- WITHOBJECT "CorelCAD.Automation.1"
- .Arc3Points WireFlag, X1,Y1,Z1,X2,Y2,Z2,X3,Y3,Z3
- END WITHOBJECT
- ARC33:
- END SUB 'CreateArc3Points
- '*************************************************************************************
- SUB CreateArcAngle (WireFlag%,ESC%)
-
- DIM Angle#
- DIM X1#,Y1#,Z1#,X2#,Y2#,Z2#
- ARCANGLE1:
- ESC=false
- GetValue "ARC -- Enter the Arc Angle",Angle#,ESC%
- if ESC=true then goto ARCANGLE3
- ARCANGLE2:
- ESC=false
- GetCoord "ARC -- Pick start point", X1#, Y1#, Z1#,ESC%
- if ESC=true then goto ARCANGLE1
- x2=x1
- y2=y1
- z2=z1
-
- ESC=false
- GetCoord "ARC -- Pick end point", X2#, Y2#, Z2#,ESC%
- if ESC=true then goto ARCANGLE2
-
- WITHOBJECT "CorelCAD.Automation.1"
- .ArcAngle WireFlag, Angle, X1, Y1, Z1, X2, Y2, Z2
- END WITHOBJECT
- ARCANGLE3:
- END SUB 'CreateArcAngle
- '*************************************************************************************
- SUB CreateArcCSE (WireFlag%,ESC%)
-
- DIM X1#,Y1#,Z1#,X2#,Y2#,Z2#,X3#,Y3#,Z3#
- ARCCSE1:
- ESC=false
- GetCoord "ARC -- Pick center of the arc",X1#,Y1#,Z1#,ESC%
- if ESC=true then goto ARCCSE3
- x2=x1
- y2=y1
- y2=y1
- ARCCSE2:
- ESC=false
- GetCoord "ARC -- Pick start point",X2#,Y2#,Z2#,ESC%
- if ESC=true then goto ARCCSE1
- x3=x2
- y3=y2
- z3=z2
-
- ESC=false
- GetCoord "ARC -- Pick end point",X3#,Y3#,Z3#,ESC%
- if ESC=true then goto ARCCSE2
- WITHOBJECT "CorelCAD.Automation.1"
- .ArcCSE WireFlag, X1, Y1, Z1, X2, Y2, Z2, X3, Y3, Z3
- END WITHOBJECT
- ARCCSE3:
-
- END SUB 'CreateArcCSE
- '*************************************************************************************
- SUB CreateArcEllipses (WireFlag%,ESC%)
-
- DIM X1#,Y1#,Z1#,X2#,Y2#,Z2#,X3#,Y3#,Z3#,X4#,Y4#,Z4#,X5#,Y5#,Z5#
- ARCELLIPSE1:
- ESC=false
- GetCoord "ARC -- Pick center of ellipse",X1#,Y1#,Z1#,ESC%
- if ESC=true then goto ARCELLIPSE5
- ESC=false
- x2=x1
- y2=y1
- z2=y1
- ARCELLIPSE2:
- ESC=false
- GetCoord "ARC -- Pick 2nd point (defines major axis)",X2#,Y2#,Z2#,ESC%
- if ESC=true then goto ARCELLIPSE1
- x3=x2
- y3=y2
- z3=y2
- ARCELLIPSE3:
- ESC=false
- GetCoord "ARC -- Pick 3rd point (defines minor axis)",X3#,Y3#,Z3#,ESC%
- if ESC=true then goto ARCELLIPSE2
- x4=x3
- y4=y3
- z4=y3
- ARCELLIPSE4:
- ESC=false
- GetCoord "ARC -- Pick 4th point (defines start angle)",X4#,Y4#,Z4#,ESC%
- if ESC=true then goto ARCELLIPSE3
- x5=x4
- y5=y4
- z5=y4
-
- ESC=false
- GetCoord "ARC -- Pick 5th point (defines stop angle)",X5#,Y5#,Z5#,ESC%
- if ESC=true then goto ARCELLIPSE4
- WITHOBJECT "CorelCAD.Automation.1"
- .ArcEllipse WireFlag, X1, Y1, Z1, X1+X2, Y1+Y2, Z1+Z2, X1+X3, Y1+Y3, Z1+Z3, X4, Y4, Z4, X5, Y5, Z5
- END WITHOBJECT
- ARCELLIPSE5:
-
- END SUB 'CreateArcEllipses
- '*************************************************************************************
- SUB CreateArcRSE (WireFlag%,ESC%)
-
- DIM RAD as double
- DIM X1#,Y1#,Z1#,X2#,Y2#,Z2#,X3#,Y3#,Z3#
- ARCRSE1:
- ESC=false
- GetValue "ARC -- Enter the radius of the arc",Rad#,ESC%
- if ESC=true then goto ARCRSE4
- ARCRSE2:
- ESC=false
- GetCoord "ARC -- Pick start point",X1#,Y1#,Z1#,ESC%
- if ESC=true then goto ARCRSE1
- x2=x1
- y2=y1
- z2=y1
- ARCRSE3:
- ESC=false
- GetCoord "ARC -- Pick 2nd point",X2#,Y2#,Z2#,ESC%
- if ESC=true then goto ARCRSE2
- x3=x2
- y3=y2
- z3=y2
-
- ESC=false
- GetCoord "ARC -- Pick end point",X3#,Y3#,Z3#,ESC%
- if ESC=true then goto ARCRSE3
- WITHOBJECT "CorelCAD.Automation.1"
- .ArcRSE WireFlag, RAD, X1, Y1, Z1, X2, Y2, Z2, X3, Y3, Z3
- END WITHOBJECT
- ARCRSE4:
-
- END SUB 'CreateArcRSE
- '*************************************************************************************
- '************************* END ARCS ***************************************
- '*************************************************************************************
- SUB CreateBox
-
-
- DIM X1#,Y1#,Z1#,dX#,dY#,dZ#,ESC%
- DIM SolidLet$
- DIM WireFlag%
- BOX1:
- ESC=false
- GetLetter "BOX -- Options","(S)olid, S(u)rface:","SU",SolidLet$,ESC%
- if ESC=true then goto BOX5
- SELECT CASE SolidLet$
- CASE "U"
- WireFlag% = 0
- CASE "S"
- WireFlag% = 1
- END SELECT
- BOX2:
- ESC=false
- GetCoord "BOX -- Pick start point",X1#,Y1#,Z1#,ESC%
- if ESC=true then goto BOX1
- BOX3:
- ESC=false
-
- GetValue "BOX -- Enter the width (X-Direction)",dX,ESC%
- if ESC=true then goto BOX2
- BOX4:
- ESC=false
- GetValue "BOX -- Enter the length (Y-Direction)",dY,ESC%
- if ESC=true then goto BOX3
-
- GetValue "BOX -- Enter the height (Z-Direction)",dZ,ESC%
- if ESC=true then goto BOX4
- WITHOBJECT "CorelCAD.Automation.1"
- .box WireFlag, X1,Y1,Z1,X1+dX,Y1+DY,Z1+dZ
- END WITHOBJECT
- BOX5:
- donebox:
- END SUB 'CreateBox
- '*************************************************************************************
- '************************* START CIRCLES **************************************
- '*************************************************************************************
- SUB CreateCircle
-
-
- DIM WireFlag%
- DIM CircType$
- DIM TypeCircle$
- DIM ESC%
- CIRCLE1:
- ESC=false
- GetLetter "CIRCLE -- Options","(W)ireframe, (S)urface:","WS", CircType$,ESC%
- if ESC=true then goto CIRCLE2
- SELECT CASE CircType$
- CASE "W"
- WireFlag% = 0
- CASE "S","s"
- WireFlag% = 1
- END SELECT
-
-
- GetLetter "CIRCLE -- Type","(C)enter,(2)Point,(3)Point: ","C23",TypeCircle$,ESC%
- if ESC=true then goto CIRCLE1
- SELECT CASE TypeCircle$
- CASE "C"
- CreateCircleRadius WireFlag%,ESC%
- If ESC = TRUE then Goto CIRCLE2
- CASE "2"
- CreateCircleDiameter WireFlag%,ESC%
- If ESC = TRUE then Goto CIRCLE2
- CASE "3"
- CreateCircle3Point WireFlag%,ESC%
- If ESC = TRUE then Goto CIRCLE2
- END SELECT
- CIRCLE2:
-
- END SUB
- '*************************************************************************************
- SUB CreateCircle3Point(WireFlag%,ESC%)
-
- DIM X1#,Y1#,Z1#,X2#,Y2#,Z2#,X3#,Y3#,Z3#
- CIRCLE31:
- ESC=false
- GetCoord "CIRCLE -- Pick 1st point",X1#,Y1#,Z1#,ESC%
- if ESC=true then goto CIRCLE33
- x2=x1
- y2=y1
- z2=y1
- CIRCLE32:
- ESC=false
- GetCoord "CIRCLE -- Pick 2nd point",X2#,Y2#,Z2#,ESC%
- if ESC=true then goto CIRCLE31
- x3=x2
- y3=y2
- z3=y2
-
-
- ESC=false
- GetCoord "CIRCLE -- Pick 3rd point",X3#,Y3#,Z3#,ESC%
- if ESC=true then goto CIRCLE32
- WITHOBJECT "CorelCAD.Automation.1"
- .Circle3Points WireFlag, X1, Y1, Z1, X2, Y2, Z2, X3, Y3, Z3
- END WITHOBJECT
- CIRCLE33:
-
- END SUB 'CreateCircle3Point
- '*************************************************************************************
- SUB CreateCircleDiameter(WireFlag%,ESC%)
-
- DIM X1#,Y1#,Z1#,X2#,Y2#,Z2#
- CIRCLED1:
- ESC=false
- GetCoord "CIRCLE -- Pick 1st point", X#, Y#, Z#,ESC%
- if ESC=true then goto CIRCLED2
- X2=x
- Y2=y
- Z2=z
-
- ESC=false
- GetCoord "CIRCLE -- Pick 2nd point (defines diameter)", X2#, Y2#, Z2#,ESC%
- if ESC=true then goto CIRCLED1
-
- WITHOBJECT "CorelCAD.Automation.1"
- .CircleDiameter WireFlag, X1, Y1, Z1, X2, Y2, Z2
- END WITHOBJECT
- CIRCLED2:
-
- END SUB 'CreateCircleDiameter
- '*************************************************************************************
- SUB CreateCircleRadius(WireFlag%,ESC%) ' THIS FUNCTION ASSUMES THE USER WANTS A CIRCLE IN THE
- ' X-Y PLANE, AND HE IS NOT ABLE TO DRAW ONE WITH ANY
- DIM X1#,Y1#,Z1# ' DIMENSION IN THE Z DIRECTION (this is easily changed if desired)
- DIM dX as double 'this could be changed to declare x2, y2, z2
- CircleRadius1:
- ESC=false
- GetCoord "CIRCLE -- Pick center of the circle",X1#,Y1#,Z1#,ESC%
- if ESC=true then goto CircleRadius2
-
- ESC=false
- GetValue "CIRCLE -- Enter the radius",dX,ESC% 'this could be changed to pick point (x2,y2,z2)
- if ESC=true then goto CircleRadius1
-
- WITHOBJECT "CorelCAD.Automation.1"
- .CircleRadius WireFlag, X1,Y1,Z1,X1+dX,Y1,Z1
- END WITHOBJECT
- CircleRadius2:
-
- END SUB 'CreateCircleRadius
- '*************************************************************************************
- '************************** END CIRCLES ****************************************
- '*************************************************************************************
- SUB CreateCone
-
- DIM X1#,Y1#,Z1#,ESC%
- DIM dX# 'for the radius
- DIM dZ# 'for the height
- DIM SolidLet$
- DIM WireFlag%
- CONE1:
- ESC=false
- GetLetter "CONE -- Options","(S)olid, S(u)rface:","SU",SolidLet$,ESC%
- if ESC=true then goto CONE4
- SELECT CASE SolidLet$
- CASE "U"
- WireFlag% = 0
- CASE "S"
- WireFlag% = 1
- END SELECT
- CONE2:
- ESC=false
- GetCoord "CONE -- Pick center of the face",X1#,Y1#,Z1#,ESC%
- if ESC=true then goto CONE1
- CONE3:
- ESC=false
- GetValue "CONE -- Enter the radius of the face", dX#,ESC% 'assumes face is in the x-y plane
- if ESC=true then goto CONE2
-
- ESC=false
- GetValue "CONE -- Enter the height of the cone",dZ#,ESC% 'assumes height is along z-axis
- if ESC=true then goto CONE3
- WITHOBJECT "CorelCAD.Automation.1"
- .Cone WireFlag,X1,Y1,Z1,X1+dX,Y1,Z1,X1,Y1,Z1+dZ
- END WITHOBJECT
- CONE4:
- END SUB 'CreateCones
- '*************************************************************************************
- SUB CreateCylinder
-
- DIM X1#,Y1#,Z1#,ESC%
- DIM dX# 'for the radius
- DIM dZ# 'for the height
- DIM SolidLet$
- DIM WireFlag%
-
- CYLINDER1:
- ESC=false
- GetLetter "CYLINDER -- Options","(S)olid, S(u)rface:","SU",SolidLet$,ESC%
- if ESC=true then goto CYLINDER4
- SELECT CASE SolidLet$
- CASE "U"
- WireFlag% = 0
- CASE "S"
- WireFlag% = 1
- END SELECT
- CYLINDER2:
- ESC=false
- GetCoord "CYLINDER -- Pick center of the face",X1#,Y1#,Z1#,ESC%
- if ESC=true then goto CYLINDER1
- CYLINDER3:
- ESC=false
- GetValue "CYLINDER -- Enter the radius of the face", dX#,ESC% 'assumes face is in the x-y plane
- if ESC=true then goto CYLINDER2
-
- ESC=false
- GetValue "CYLINDER -- Enter the height of the cylinder",dZ#,ESC% 'assumes height is along z-axis
- if ESC=true then goto CYLINDER3
- WITHOBJECT "CorelCAD.Automation.1"
- .Cylinder WireFlag,X1,Y1,Z1,X1+dX,Y1,Z1,X1,Y1,Z1+dZ
- END WITHOBJECT
- CYLINDER4:
-
- END SUB 'CreateCylinder
- '*************************************************************************************
- SUB CreateEllipse
-
- DIM X1#,Y1#,Z1#,X2#,Y2#,Z2#,X3#,Y3#,Z3#,ESC%
- DIM EllType$
- ELLIPSE1:
- ESC=false
- GetLetter "ELLIPSE -- Options","(W)ireframe, (S)urface:","WS", EllType$,ESC%
- if ESC=true then goto ELLIPSE4
- SELECT CASE EllType$
- CASE "W"
- WireFlag% = 0
- CASE "S","s"
- WireFlag% = 1
- END SELECT
-
- ELLIPSE2:
- ESC=false
- GetCoord "ELLIPSE -- Pick center",X1#,Y1#,Z1#,ESC%
- if ESC=false then goto ELLIPSE1
- x2=x1
- y2=y1
- z2=y1
- ELLIPSE3:
- ESC=false
- GetCoord "ELLIPSE -- Pick 2nd point (defines major axis)",X2#,Y2#,Z2#,ESC%
- if ESC=false then goto ELLIPSE2
- x3=x2
- y3=y2
- z3=y2
-
- ESC=false
- GetCoord "ELLIPSE -- Pick 3rd point (defines minor axis)",X3#,Y3#,Z3#,ESC%
- if ESC=false then goto ELLIPSE3
- WITHOBJECT "CorelCAD.Automation.1"
- .Ellipse WireFlag,X1,Y1,Z1,X2,Y2,Z2,X3,Y3,Z3
- END WITHOBJECT
- ELLIPSE4:
- donell:
- END SUB 'CreateEllipse
- '*************************************************************************************
- SUB CreateFrustum
-
- DIM X1#,Y1#,Z1#,X2#,Y2#,Z2#,X3#,Y3#,Z3#,X4#,Y4#,Z4#,X5#,Y5#,Z5#,ESC%
- DIM SolidLet$
- DIM WireFlag%
- FRUSTUM1:
- ESC=false
- GetLetter "FRUSTUM -- Options","(S)olid, S(u)rface:","SU",SolidLet$,ESC%
- if ESC=true then goto FRUSTUM6
- SELECT CASE SolidLet$
- CASE "U"
- WireFlag% = 0
- CASE "S"
- WireFlag% = 1
- END SELECT
- FRUSTUM2:
- ESC=false
- GetCoord "FRUSTUM -- Pick center of the base",X1#,Y1#,Z1#,ESC%
- if ESC=true then goto FRUSTUM1
- x2=x1
- y2=y1
- z2=y1
- FRUSTUM3:
- ESC=false
- GetCoord "FRUSTUM -- Pick 2nd point (defines radius of base)",X2#,Y2#,Z2#,ESC%
- if ESC=true then goto FRUSTUM2
- x3=x2
- y3=y2
- z3=y2
- FRUSTUM4:
- ESC=false
- GetCoord "FRUSTUM -- Pick 3rd point (defines center of second face)",X3#,Y3#,Z3#,ESC%
- if ESC=true then goto FRUSTUM3
- x4=x3
- y4=y3
- z4=y3
- FRUSTUM5:
- ESC=false
- GetCoord "FRUSTUM -- Pick 4th point (defines radius of second face)",X4#,Y4#,Z4#,ESC%
- if ESC=true then goto FRUSTUM4
- x5=x4
- y5=y4
- z5=y4
-
- ESC=false
-
- WITHOBJECT "CorelCAD.Automation.1"
- .Frustum WireFlag,X1,Y1,Z1,X2,Y2,Z2,X3,Y3,Z3,X4,Y4,Z4
- END WITHOBJECT
- FRUSTUM6:
-
-
- END SUB 'CreateFrustum
- '*************************************************************************************
- SUB CreateHemisphere
-
- DIM X1#,Y1#,Z1#,X2#,Y2#,Z2#,X3#,Y3#,Z3#,ESC%
- DIM SolidLet$
- DIM WireFlag%
- HEMISPHERE1:
- ESC=false
- GetLetter "HEMISPHERE -- Options","(S)olid, S(u)rface:","SU",SolidLet$,ESC%
- if ESC=true then goto Hemisphere4
- SELECT CASE SolidLet$
- CASE "U"
- WireFlag% = 0
- CASE "S"
- WireFlag% = 1
- END SELECT
- HEMISPHERE2:
- ESC=false
- GetCoord "HEMISPHERE -- Pick center of the face",X1#,Y1#,Z1#,ESC%
- if ESC=true then goto HEMISPHERE1
- x2=x1
- y2=y1
- z2=y1
- HEMISPHERE3:
- ESC=false
- GetCoord "HEMISPHERE -- Pick 2nd point (defines radius)",X2#,Y2#,Z2#,ESC%
- if ESC=true then goto HEMISPHERE2
- x3=x2
- y3=y2
- z3=y2
-
- ESC=false
- GetCoord "HEMISPHERE -- Pick 3rd point (defines direction of bowl)",X3#,Y3#,Z3#,ESC%
- if ESC=true then goto HEMISPHERE3
- WITHOBJECT "CorelCAD.Automation.1"
- .HemiSphere WireFlag,X1,Y1,Z1,X2,Y2,Z2,X3,Y3,Z3
- END WITHOBJECT
- HEMISPHERE4:
-
- donehem:
- END SUB 'CreateHemisphere
- '*************************************************************************************
- SUB CreateLine (PolyFlag%)
-
- DIM i% 'counter
- DIM NumPoints%
- DIM StrArray$(10)
- DIM x#,y#,z#,ESC%
- DIM Points#(100,3)
- DIM EntryStr$
-
- EntryStr$= "POLYLINE -- Pick starting point"
- If (PolyFlag%=FALSE) then EntryStr$= "LINE SEGMENTS -- Pick starting point"
-
- GetCoord EntryStr$, x#,y#,z#,ESC%
- If ESC = TRUE then Goto AllDone
-
- Points#(1,1)= x
- Points#(1,2)= y
- Points#(1,3)= z
-
- FOR i%=2 to 100
- oops:
- temp$=LTRIM(str(i))
-
- ESC=false
- GetCoord temp$, x#, y#, z#,ESC%
-
- IF temp$="C" then
- Points#(i,1)=Points#(1,1)
- Points#(i,2)=Points#(1,2)
- Points#(i,3)=Points#(1,3)
- goto DoneFor
- ELSEIF temp$="D" then
- i%=i-1
- goto DoneFor
- ELSEIF temp$="E" then
- goto Edit
- ELSE
- Points#(i,1)=x
- Points#(i,2)=y
- Points#(i,3)=z
- ENDIF
- NEXT I%
-
- DoneFor:
-
- WITHOBJECT "CorelCad.Automation.1"
- NumPoints%=i%
- FOR i%=1 to NumPoints
- .SetPointXYZ Points#(i,1), Points#(i,2), Points#(i,3)
- NEXT i%
- IF (PolyFlag = TRUE) THEN
- .PolyLine
- ELSE
- .LineSegment
- ENDIF
- goto alldone
- END WITHOBJECT
-
- EDIT:
- NumPoints%=i-1
-
- FOR i%=1 to NumPoints
- x#=Points(i,1)
- y#=Points(i,2)
- z#=Points(i,3)
- StrArray$(i)= str(i)+") ("+str(x)+","+str(y)+","+str(z)+")"
- NEXT i%
-
- BoxL%=10*NumPoints+4 'defines the length of the list box
- DiaL%=10*NumPoints+40 'defines the length of the dialogue box
-
- Default%= NumPoints
- BEGIN DIALOG EDSTR 123, DiaL, "Edit a point"
- TEXT 2, 22, 82, 9, "Pick point to edit:"
- LISTBOX 28, 36, 65, BoxL, StrArray$, Default%
- OKBUTTON 51, 4, 35, 14
- CANCELBUTTON 88, 4, 35, 14
- END DIALOG
-
- ret= DIALOG(EDSTR)
- if ret=2 then goto oops
-
- X#=Points(Default,1)
- Y#=Points(Default,2)
- Z#=Points(Default,3)
-
- GetCoord "Enter new absolute coordinate",X#,Y#,Z#,ESC%
- Points#(Default,1)=x
- Points#(Default,2)=y
- Points#(Default,3)=z
- goto oops
-
- alldone:
- END SUB 'CreateLine
- '*************************************************************************************
- SUB CreatePolygon
-
- DIM X1#,Y1#,Z1#,X2#,Y2#,Z2#,X3#,Y3#,Z3#,ESC%
- DIM PolyChoice$
- DIM numedges#
- DIM numedge&
- DIM wireflag%
- DIM answer$
- DIM saveassurface%
-
- POL1:
- Getletter "POLYGON -- Properties","(S)urface or (W)ire?","SW",answer$,ESC%
- If ESC = true then goto POL8
- '*********
- if answer$="S" then
- saveassurface=-1
- ELSE
- saveassurface=0
- end if
- '*********
- POL2:
- GetLetter "POLYGON -- Construction","Construction Type: (C)enter or (E)dge","CE",PolyChoice,ESC%
- If ESC = true then goto POL1
-
- POL3:
- GetValue "POLYGON -- Number of sides:",numedges#,ESC%
- If ESC = true then goto POL2
- numedge = cint(numedges)
-
- IF polychoice$="C" then
- POL4:
- GetCoord "POLYGON -- Enter the center of the polygon",X1#,Y1#,Z1#,ESC%
- If ESC = true then goto POL3
- POL5:
- GetCoord "POLYGON -- Middle of an edge" ,X2#,Y2#,Z2#,ESC%
- If ESC = true then goto POL4
- ELSE
- POL6:
- GetCoord "POLYGON -- Enter first vertex" ,X1#,Y1#,Z1#,ESC%
- If ESC = true then goto POL3
- POL7:
- GetCoord "POLYGON -- Enter second vertex" ,X2#,Y2#,Z2#,ESC%
- If ESC = true then goto POL6
- END IF
- message saveassurface
- message numedge
-
- Withobject "CorelCAD.Automation.1"
- If PolyChoice = "C" then
- .Polygoncenter saveassurface,X1,Y1,Z1,X2,Y2,Z2,numedge
- ELSE
- .Polygonedge saveassurface,X1,Y1,Z1,X2,Y2,Z2,numedge
- END IF
- end withobject
-
- POL8:
- END SUB
- '*************************************************************************************
- SUB CreateRectangle
-
- DIM X1#,Y1#,Z1#,X2#,Y2#,Z2#,X3#,Y3#,Z3#,ESC%
- DIM answer$,saveassurface%
- RECTANGLE1:
- ESC=false
- Getletter "RECTANGLE -- Properties","Save the object as a (S)urface or (W)ire?","SW",answer$,ESC%
- if ESC=true then goto RECTANGLE4
- if answer$="S" then
- saveassurface=-1
- else
- saveassurface=0
- endif
- RECTANGLE2:
- ESC=false
- GetCoord "Enter the start point of the rectangle",X1#,Y1#,Z1#,ESC%
- if ESC=true then goto RECTANGLE1
- RECTANGLE3:
- ESC=false
- GetCoord "Enter the end point of the rectangle" ,X2#,Y2#,Z2#,ESC%
- if ESC=true then goto RECTANGLE2
-
- Withobject "corelcad.automation.1"
- .Rectangle saveassurface,X1,Y1,Z1,X2,Y2,Z2
- end withobject
-
- RECTANGLE4:
- END SUB
- '*************************************************************************************
-
- SUB CreateSphere
-
- DIM X1#
- DIM Y1#
- DIM Z1#
- DIM ESC%
- DIM Radius#
- DIM SolidLet$
- DIM WireFlag%
- SPHERE1:
- ESC=false
- GetLetter "SPHERE -- Options","(S)olid, S(u)rface:","SU",SolidLet$,ESC%
- if ESC=true then goto SPHERE3
- SELECT CASE SolidLet$
- CASE "U"
- WireFlag% = 0
- CASE "S"
- WireFlag% = 1
- END SELECT
- SPHERE2:
- ESC=false
- GetCoord "SPHERE -- Pick center of the sphere",X1#,Y1#,Z1#,ESC%
- if ESC=true then goto SPHERE1
-
- ESC=false
- GetValue "SPHERE -- Enter the radius of the sphere",Radius#,ESC%
- if ESC=true then goto SPHERE2
- WITHOBJECT "CorelCAD.Automation.1"
- .Sphere WireFlag,X1,Y1,Z1,X1+Radius,Y1,Z1
- END WITHOBJECT
- SPHERE3:
-
- END SUB 'CreateSphere
- '*************************************************************************************
- SUB CreateTorus
-
- DIM X1#,Y1#,Z1#,X2#,Y2#,Z2#,X3#,Y3#,Z3#,X4#,Y4#,Z4#,ESC%
- DIM SolidLet$
- DIM WireFlag%
- TORUS1:
- ESC=false
- GetLetter "TORUS -- Options","(S)olid, S(u)rface:","SU",SolidLet$,ESC%
- if ESC=true then goto TORUS5
- SELECT CASE SolidLet$
- CASE "U"
- WireFlag% = 0
- CASE "S"
- WireFlag% = 1
- END SELECT
- TORUS2:
- ESC=false
- GetCoord "TORUS -- Pick center of the torus",X1#,Y1#,Z1#,ESC%
- if ESC=true then goto TORUS1
- x2=x1
- y2=y1
- z2=y1
- TORUS3:
- ESC=false
- GetCoord "TORUS -- Pick 2nd point (defines center of tube)",X2#,Y2#,Z2#,ESC%
- if ESC=true then goto TORUS2
- x3=x2
- y3=y2
- z3=y2
- TORUS4:
- ESC=false
- GetCoord "TORUS -- Pick 3rd point (defines the plane of the torus)",X3#,Y3#,Z3#,ESC%
- if ESC=true then goto TORUS3
- x4=x3
- y4=y3
- z4=y3
-
- ESC=false
- GetCoord "TORUS -- Pick 4th point (defines the height of the torus)",X4#,Y4#,Z4#,ESC%
- if ESC=true then goto TORUS4
- WITHOBJECT "CorelCAD.Automation.1"
- .Torus WireFlag,X1,Y1,Z1,X2,Y2,Z2,X3,Y3,Z3,X4,Y4,Z4
- END WITHOBJECT
- TORUS5:
-
- donetor:
- END SUB 'CreateTorus
-
- '*************************************************************************************
- '*************************************************************************************
- '*************************************************************************************
- '************************ MANIPULATING FUNCTIONS *******************************
- '*************************************************************************************
- '*************************************************************************************
- '*************************************************************************************
- '*************************************************************************************
- SUB GetCoord (DiaText,X#,Y#,Z#,ESC%)
-
- DIM WantRel% 'boolean, if the user enters relative coords or not (@)
- DIM TestPoly$,DispStr$
- DIM WantAng% 'boolean, whether the user wants angular coords or not
-
- WantAng%= FALSE
- WantRel%= FALSE
- TestPoly$= DiaText
-
- DispStr$= "Enter a coordinate (x,y,z):"
-
- IF (VAL(LTRIM(TestPoly$)) > 1) AND (val(LTRIM(TestPoly$)) < 100) AND (CBOL(instr(TestPoly$,"ARRAY"))=false) then
- DispStr$= "OR: (C)lose,(D)one,(E)dit:"
- TempStr$= DiaText$
- DiaText$= "POLYINE -- Please choose point #"+TempStr$
- ENDIF
-
-
- GtCoord:
- Coord$= "0,0,0"
- IF TestPoly$= "Enter new absolute coordinate" then Coord$= LTRIM(str(X))+","+LTRIM(STR(Y))+","+LTRIM(STR(z))
-
- BEGIN DIALOG PNT 47, 372, 254, 16, DiaText$
- TEXT 2, 3, 181, 13, DispStr$
- TEXTBOX 83, 2, 85, 13, Coord$
- OKBUTTON 170, 1, 40, 15
- CANCELBUTTON 214, 1, 40, 15
- END DIALOG
-
- ESC = FALSE
- ret = DIALOG (PNT)
- IF ret = 2 then
- ESC = true
- goto done
- END IF
-
- IF (val(LTRIM(TestPoly$)) > 1) AND (val(LTRIM(TestPoly$)) < 100) then
- Coord$=UCASE (Coord$)
- SELECT CASE Coord$
- CASE "C"
- DiaText$="C"
- goto done
- CASE "D"
- DiaText$="D"
- goto done
- CASE "E"
- DiaText$="E"
- goto done
- END SELECT
- ENDIF
-
- Coord$=LTRIM (Coord$)
- Coord$=RTRIM (Coord$)
- IF (INSTR (Coord,"@")=1) then
- WantRel%= TRUE
- Coord$=RIGHT(Coord$,LEN(Coord$)-1)
- ENDIF
- PosCom1%= INSTR(Coord$,",")
- PosCom2%= INSTR(Coord$,",",PosCom1+1)
-
- If (PosCom2<>0) AND (INSTR(Coord$,",",PosCom2+1) <> 0) THEN
- goto Errror
- ELSE goto NotError
- ENDIF
-
- Errror:
- BEGIN DIALOG Err 342, 94, "INCORRECT FORMAT"
- GROUPBOX 4, 36, 145, 48, "Examples of correct format"
- TEXT 71, 51, 40, 11, "1.5, 2.5, 3.5"
- TEXT 22, 49, 40, 11, "2, 3, 4"
- TEXT 31, 68, 106, 12, "1,3 (Z set to 0 as default)"
- TEXT 17, 8, 163, 8, "I'm sorry, you have entered an incorrect format. "
- TEXT 152, 24, 124, 16, "PLEASE TRY AGAIN"
- OKBUTTON 233, 47, 47, 16
- CANCELBUTTON 287, 47, 47, 16
- END DIALOG
-
- RET = DIALOG(Err)
- If RET = 2 then goto done
- Coord$="0,0,0"
- goto GtCoord
- NotError:
-
- Num1$= LEFT(Coord$, PosCom1-1)
- Num2$= MID(Coord$, PosCom1+1, PosCom2-PosCom1-1)
- Num3$= RIGHT(Coord$,LEN(Coord$)-PosCom2)
-
- If PosCom1=0 then
- Num1$=Coord$
- Num2$="0"
- Num3$="0"
- ELSEIF PosCom2=0 then
- Num2$=RIGHT(Coord$,LEN(Coord$)-PosCom1)
- Num3$="0"
- ENDIF
-
- Num1=LTRIM (Num1)
- Num1=RTRIM (Num1)
- Num2=LTRIM (Num2)
- Num2=RTRIM (Num2)
- Num3=LTRIM (Num3)
- Num3=RTRIM (Num3)
-
- If (Num1$ = "0") OR (Num1$ = "0.") OR (Num1$ = "0.0") OR (Num1$ = "0.00") then
- X=0
- ELSEIF WantRel%=TRUE then
- X=VAL(Num1$)+X
- ELSEIF VAL(Num1$)=0 then
- goto Errror
- ELSE
- X=VAL(Num1$)
- ENDIF
-
- If (Num2$ = "0") OR (Num2$ = "0.") OR (Num2$ = "0.0") OR (Num2$ = "0.00") then
- Y=0
- ELSEIF WantRel%=TRUE then
- y=VAL(Num2$)+Y
- ELSEIF VAL(Num2$)=0 then
- goto Errror
- ELSE
- y=VAL(Num2$)
- ENDIF
-
- IF (Num3$ = "0") OR (Num3$ = "0.") OR (Num3$ = "0.0") OR (Num3$ = "0.00") then
- Z=0
- ELSEIF WantRel%=TRUE then
- Z=VAL(Num3$)+Z
- ELSEIF VAL(Num3$)=0 then
- goto Errror
- ELSE
- Z=VAL(Num3$)
- ENDIF
-
- Done:
-
- END SUB
- '*************************************************************************************
- SUB GetValue (DiaText,dX,ESC%)
-
- DIM ArrBool%
-
- Dist:
- Num$="0"
- ArrBool= CBOL(instr(DiaText$,"of copies")) 'will be true if this fcn is being called from an array command
-
- If (ArrBool=true) then Num$="2" 'sets a new default, numcopies as being 2
- If CBOL(instr(DiaText$,"of copies "))=true then Num$=20
- If CBOL(instr(DiaText$,"Arc Angle"))=true then Num$=180
- If CBOL(instr(DiaText$,"Y -- Angle of"))=true then Num$=360
-
-
- BEGIN DIALOG Dialog1 47, 372, 254, 16, DiaText$
- TEXT 7, 4, 144, 12, "Please enter a value:"
- TEXTBOX 76, 3, 88, 13, Num$
- OKBUTTON 170, 1, 40, 15
- CANCELBUTTON 214, 1, 40, 15
- END DIALOG
-
- ESC= false
- ret = DIALOG(Dialog1)
- If ret=2 then ESC = true
-
- Num = LTRIM (Num)
- Num = RTRIM (Num)
-
- If (Num$ = "0") OR (Num$ = "0.") OR (Num$ = "0.0") OR (Num$ = "0.00") then
- dX=0
- ELSEIF (ArrBool=True)AND(Val(Num$)-cint(val(Num$)) <>0) then 'checks if user entered integer(for array command)
- Message ("I'm sorry, but you must enter an integer. Please try again")
- goto DIST
- ELSEIF VAL(Num$)=0 then
- BEGIN DIALOG Errr 334, 75, "INCORRECT ENTRY"
- GROUPBOX 4, 36, 145, 29, "Examples of correct format"
- TEXT 14, 51, 40, 11, "1.5"
- TEXT 66, 51, 40, 11, "2"
- TEXT 102, 51, 40, 11, "6.56677889"
- TEXT 17, 8, 163, 8, "I'm sorry, you have entered an incorrect format. "
- TEXT 152, 24, 124, 16, "PLEASE TRY AGAIN"
- OKBUTTON 233, 47, 47, 16
- CANCELBUTTON 287, 47, 47, 16
- END DIALOG
- ret = DIALOG(ERRR)
- If ret=2 then stop
- goto DIST
- ELSE
- dX=VAL(Num$)
- ENDIF
- donedis:
-
- END SUB
- '*************************************************************************************
- '*************************************************************************************
- SUB GetLetter(TitleText$,DiaText$,LetAvail$,LetPicked$,ESC%)
-
- ' the first character in the LetAvail string will be assigned to this variable
-
- DO
- LetAvail = UCASE (LetAvail)
- LetPicked = LEFT (LetAvail,1)
-
- BEGIN DIALOG DiaLetter 47, 372, 254, 16, TitleText$
- TEXT 0, 4, 197, 12, DiaText$
- TEXTBOX 118, 2, 48, 13, LetPicked$
- OKBUTTON 170, 1, 40, 15
- CANCELBUTTON 212, 1, 40, 15
- END DIALOG
-
- ret=DIALOG(DiaLetter)
- If ret =2 then
- ESC = TRUE
- goto DONELETTER
- end IF
- LetPicked=LTRIM(LetPicked)
- LetPicked=RTRIM(LetPicked)
- LetPicked=UCASE(LetPicked)
-
- Correct= CBOL(instr(LetAvail,LetPicked))
- If Correct=false then message "Sorry, not a correct entry. Pick a character in brackets."
-
- LOOP WHILE Correct = FALSE
-
-
-
- DONELETTER:
- END SUB
- '*************************************************************************************
- '*************************************************************************************
-
- SUB DoMove
-
- DIM dX#,dY#,dZ#,ESC% ' the user defines the offset wanted
-
- GetValue "Enter an offset in the X-direction",dX#,ESC%
- GetValue "Enter an offset in the Y-direction",dY#,ESC%
- GetValue "Enter an offset in the Z-direction",dZ#,ESC%
-
- WITHOBJECT "CorelCAD.Automation.1"
- .move 0,0,0,0,0,dX#,dY#,dZ#
- END WITHOBJECT
-
- END SUB
- '*************************************************************************************
- '*************************************************************************************
- SUB DoScale
-
- DIM ScaleNum#
- DIM X#,Y#,Z#,ESC%
-
- GetValue "Enter a scale factor",ScaleNum#,ESC%
- GetCoord "SCALE -- Base Point",x#,Y#,Z#,ESC%
-
- WITHOBJECT "CorelCAD.Automation.1"
- .Scale 0,ScaleNum#,X,Y,Z
- END WITHOBJECT
-
- END SUB
- '*************************************************************************************
- '*************************************************************************************
- SUB DoExtrude
-
-
- DIM X#,Y#,Z#,X2#,Y2#,Z2#,Scale#,Scalevalue%,ESC%
-
- withobject"corelcad.automation.1"
- EXTRUDE1:
- ESC=false
- Getcoord "EXTRUDE -- Enter the first point:",X#,Y#,Z#,ESC%
- if ESC=true then goto EXTRUDE3
- EXTRUDE2:
- ESC=false
- Getcoord "EXTRUDE -- Enter the Second point",X2#,Y2#,Z2#,ESC%
- if ESC=true then goto EXTRUDE1
-
- Getvalue "EXTRUDE -- Please enter extrusion scale",scale#,ESC%
- if ESC=true then goto EXTRUDE2
- Scalevalue%=cint(scale)
-
-
- .StartAddCmdPoint 2
- .AddCmdPoint X#,Y#,Z#
- .addcmdpoint X2#,Y2#,Z2#
- .EndAddCmdPoint
-
-
- .extrude .extrudescale = scalevalue
-
- end withobject
- EXTRUDE3:
-
- END SUB
- '*************************************************************************************
- '*************************************************************************************
- SUB DoPaste
-
- DIM X#,Y#,Z#,ESC%
-
- Withobject "CorelCAD.Automation.1"
- GetCoord "PASTE -- Enter the coordinate for object placement:",X#,Y#,Z#,ESC%
- .EditPaste X,Y,Z
- end withobject
-
- END SUB
-
-
- '*************************************************************************************
- '*************************************************************************************
- SUB DoChangeColor
-
- DIM ColorChoice%
- DIM Color$(7)
- DIM Red%,Green%,Blue%
-
- ColorChoice = 1
-
- Color(1)="Red"
- Color(2)="Orange"
- Color(3)="Yellow"
- Color(4)="Green"
- Color(5)="Blue"
- Color(6)="Indigo"
- Color(7) ="Violet"
-
- BEGIN DIALOG ColorDlg 97, 118, "CHANGE COLOR"
- GROUPBOX 4, 6, 83, 85, "Colors Available"
- LISTBOX 15, 20, 62, 67, Color$, ColorChoice%
- OKBUTTON 6, 100, 40, 14
- CANCELBUTTON 50, 100, 40, 14
- END DIALOG
-
- ret = DIALOG(ColorDlg)
- If ret = 2 then goto Done:
-
- WithObject "CorelCAD.Automation.1"
-
- Select Case ColorChoice
- Case 1
- .ChangeColor 255, 0, 51
- Case 2
- .ChangeColor 255, 153, 0
- Case 3
- .ChangeColor 255, 255, 0
- Case 4
- .ChangeColor 51, 255, 0
- Case 5
- .ChangeColor 0, 0, 255
- Case 6
- .ChangeColor 0, 255, 255
- Case 7
- .ChangeColor 51, 0, 102
- END SELECT
- End WithObject
-
- DONE:
- END SUB
- '*************************************************************************************
- '*************************************************************************************
- SUB DoZoom
-
- DIM Zoom$ 'letter picked for zoom
- DIM X#,Y#,Z#,X1#,Y1#,Z1#
-
- ZZ2:
- GetLetter "Zoom Type","(A)ll,(S)elected,(I)n,(O)ut,(P)revious","ASIOP",Zoom$,ESC%
- If ESC = true then goto Doo
- Withobject "CorelCAD.Automation.1"
- Select Case Zoom
- CASE "A"
- .zoomToAll
- CASE "S"
- .ZoomToSelected
- CASE "I"
- ZZ1:
- GetCoord "Enter the first point for the zoom box:",X#,Y#,Z#,ESC%
- If ESC = true then goto ZZ2
- X1=X
- Y1=Y
- Z1=Z
- GetCoord "Enter the end point for the zoom box:",X1#,Y1#,Z1#,ESC%
- If ESC = true then goto ZZ1
- .ZoomIn X,Y,Z,X1,Y1,Z1
- CASE "O"
- .ZoomOut
- CASE "P"
- .ZoomPrevious
- end select
-
- End Withobject
-
- doo:
- END SUB
-
-
-
-
-
-